OstreeRepoFinderConfig: Fix guint/gsize confusion
authorSimon McVittie <smcv@debian.org>
Sun, 24 Jun 2018 11:56:49 +0000 (12:56 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 27 Jun 2018 15:24:18 +0000 (15:24 +0000)
commit47ae4f5c7e9ed72b79b39df71b620bf6ace2b88a
tree4c2a4b68382349cfbe7f0cc9d80d668894328b53
parent25e17e0b62e26a0ca82cd2a42d06ddd04274d475
OstreeRepoFinderConfig: Fix guint/gsize confusion

If a function has a guint "out argument", passing a pointer to a gsize
is not, in general, valid. On an ILP64 platform there is no problem
since guint and gsize are identical, but on an LP64 platform it will
overwrite only the first word of the gsize, leaving the second word
unaffected. On little-endian machines, if the second word is
zero-initialized (as it is here), the result is numerically equal to
the guint, but on big-endian machines the result is around 4 billion
times what it should be, resulting in
ostree_repo_finder_config_resolve_async() reading past the end of
the array and causing undefined behaviour.

In practice this caused assertion failures (and consequently test
failures) on Debian's s390x (z/Architecture), ppc64 (64-bit PowerPC)
and sparc64 (64-bit SPARC) ports.

Closes: #1640
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #1641
Approved by: cgwalters
src/libostree/ostree-repo-finder-config.c